
function find(){
    let pageCode = $("#expPickUserId").val().trim()
    console.log(pageCode)
    if(null ==pageCode || pageCode ==""){
        layer.msg("请输入取件码！")
    }else if(pageCode.length !=6){
        layer.msg("取件码为6位纯数字！")
    }else {
        $.ajax({
            url: url + "/userPageInfo/selectByPageCode",
            type: "post",
            dataType: "json",
            data: "pageCode=" + pageCode,
            success: function (data) {
                console.log(data)
                if (data.data != null && "待取件" == data.data.status) {
                    $("#expUserInfoCont").html("");
                    var express = data.data;
                    // var time = data.data.updateTime
                    // var updateTime = new Date((new Date(time)).getTime()).format("yyyy-MM-dd hh:mm:ss");
                    var item = "<div class=\"expInfoCont status1\">\n" +
                        "\t\t\t<table>\n" +
                        "\t\t\t\t<tr>\n" +
                        "\t\t\t\t\t<td>快递公司：</td><td>" + "瞬达快递" + "</td>\n" +
                        "\t\t\t\t</tr>\n" +
                        "\t\t\t\t<tr>\n" +
                        "\t\t\t\t\t<td>快递编号：</td><td>" + express.pageNum + "</td>\n" +
                        "\t\t\t\t</tr>\n" +
                        "\t\t\t\t<tr>\n" +
                        "\t\t\t\t\t<td>到件时间：</td><td>" + express.updateTime + "</td>\n" +
                        "\t\t\t\t</tr>\n" +
                        "\t\t\t\t<tr>\n" +
                        "\t\t\t\t\t<td>取件码为：</td><td>" + express.pageCode + "</td>\n" +
                        "\t\t\t\t</tr>\n" +
                        "\t\t\t</table>\n" +
                        "\t\t\t<div class=\"btns\">\n" +
                        "\t\t\t\t<button class=\"btn-success\" onclick=\"updateStatus('" + express.pageCode + "')\">确认收货</button>\n" +
                        "\t\t\t</div>\n" +
                        "\t\t</div>";
                    $("#expUserInfoCont").append($(item));
                } else {
                    layer.msg("取件码不存在")
                    $("#expUserInfoCont").html("")
                }
            }
        })
    }
}
//时间转换
Date.prototype.format = function(fmt) {
    var o = {
        "M+" : this.getMonth()+1,                 //月份
        "d+" : this.getDate(),                    //日
        "h+" : this.getHours(),                   //小时
        "m+" : this.getMinutes(),                 //分
        "s+" : this.getSeconds(),                 //秒
        "q+" : Math.floor((this.getMonth()+3)/3), //季度
        "S"  : this.getMilliseconds()             //毫秒
    };
    if(/(y+)/.test(fmt)) {
        fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
    }
    for(var k in o) {
        if(new RegExp("("+ k +")").test(fmt)){
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
        }
    }
    return fmt;
}

function updateStatus(pageCode){
        $.ajax({
            url: url +"/userPageInfo/signInPage",
            data: "pageCode="+pageCode,
            dataType: "json",
            type: "post",
            success:function (data) {
                console.log(data)
                if(1 == data.code){
                    layer.msg("取件成功")
                    $("#expUserInfoCont").html("")
                    $("#expPickUserId").val("")
                }else if(2 == data.code) {
                    layer.msg("取件失败")
                }
            }
        })
}